package com.jial08.designpatterns.factory.abst;

import com.jial08.designpatterns.factory.abst.color.Color;
import com.jial08.designpatterns.factory.abst.color.impl.Green;
import com.jial08.designpatterns.factory.abst.color.impl.Red;
import com.jial08.designpatterns.factory.abst.shape.Shape;
import org.apache.commons.lang3.StringUtils;

/**
 * <p>类描述：。</p>
 *
 * @author jl
 * @version v1.0.0.1。
 * @since JDK1.8。
 * <p>创建日期：2019/10/14 上午9:27。</p>
 */
public class ColorFactory extends AbstractFactory {
	@Override
	public Shape getShape(String shape) {
		return null;
	}

	@Override
	public Color getColor(String color) {
		if (StringUtils.isBlank(color)) {
			return null;
		}
		if ("red".equalsIgnoreCase(color)) {
			return new Red();
		} else if ("green".equalsIgnoreCase(color)) {
			return new Green();
		}
		return null;
	}
}
